<?php


namespace App\Model;


use App\Utils\Upload\View;

/**
 * Class CertificationCompanyApply
 * @package App\Model
 * @property int id
 * @property int status
 * @property int user_id
 * @property int cooperative_id
 * @property string name
 * @property string credit_code
 * @property string license_img
 * @property string message
 * @property string created_at
 * @property User user
 */
class CertificationCompanyApply extends Model
{
    protected $table = 'certification_company_apply';

    protected $fillable = ['message', 'status'];

    public function user()
    {
        return $this->belongsTo(User::class);
    }


    public function getLicenseImgAttribute($value)
    {
        if ($value) {
            return [
                'image_id' => $value,
                'image_path' => di(View::class)->fullPath($value)
            ];
        } else {
            return '';
        }
    }


}